package com.devilvan.betrice.aiqicha.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.util.Date;

/**
 * @author Evad.Wu
 * @Description 爱企查-企业经营异常信息 映射
 * @date 2022-09-23
 */
@Setter
@Getter
@ToString(exclude = "aiqichaHeaderPo")
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "AIQICHA_ABNORMAL")

@Entity
@Table(name = "AIQICHA_ABNORMAL")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "爱企查-企业经营异常信息 映射")
public class AiqichaAbnormalPo extends BasePo {
    @Serial
    private static final long serialVersionUID = -5050676827383752310L;
    @Schema(description = "企业系统ID")
    @TableField(value = "PID")
    @Column(name = "PID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '企业系统ID'")
    private Long pid;
    @Schema(description = "列入日期")
    @TableField(value = "ENTER_DATE")
    @Column(name = "ENTER_DATE", columnDefinition = "DATETIME COMMENT '列入日期'")
    private Date enterDate;
    @Schema(description = "列入经营异常名录原因")
    @TableField(value = "ENTER_REASON")
    @Column(name = "ENTER_REASON", columnDefinition = "TEXT(65,535) COMMENT '列入经营异常名录原因'")
    private String enterReason;
    @Schema(description = "列入决定机关")
    @TableField(value = "AUTHORITY")
    @Column(name = "AUTHORITY", columnDefinition = "VARCHAR(128) COMMENT '列入决定机关'")
    private String authority;
    @Schema(description = "移除日期")
    @TableField(value = "LEAVE_DATE")
    @Column(name = "LEAVE_DATE", columnDefinition = "DATETIME COMMENT '移除日期'")
    private Date leaveDate;
    @Schema(description = "移出经营异常名录原因")
    @TableField(value = "LEAVE_REASON")
    @Column(name = "LEAVE_REASON", columnDefinition = "TEXT(65,535) COMMENT '移出经营异常名录原因'")
    private String leaveReason;
    @Schema(description = "移出决定机关")
    @TableField(value = "LEAVE_AUTHORITY")
    @Column(name = "LEAVE_AUTHORITY", columnDefinition = "VARCHAR(128) COMMENT '移出决定机关'")
    private String leaveAuthority;

    @Schema(description = "基本信息")
    @TableField(exist = false)
    @ManyToOne(targetEntity = AiqichaHeaderPo.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "PID", referencedColumnName = "PID", insertable = false, updatable = false)
    private AiqichaHeaderPo aiqichaHeaderPo;
}
